{include="header"}

<script type="text/javascript">
   function fs_marcar_todo()
   {
      $('#f_cajas input:checkbox').prop('checked', true);
   }
   function fs_marcar_nada()
   {
      $('#f_cajas input:checkbox').prop('checked', false);
   }
</script>

<form id="f_cajas" action="{$fsc->url()}" method="post" class="form">
   <div class="container-fluid" style="margin-top: 10px; margin-bottom: 10px;">
      <div class="row">
         <div class="col-lg-6 col-md-6 col-sm-6">
            <div class="btn-group">
               <button class="btn btn-sm btn-default" type="button" onclick="fs_marcar_todo()">
                  <span class="glyphicon glyphicon-check"></span>
               </button>
               <button class="btn btn-sm btn-default" type="button" onclick="fs_marcar_nada()">
                  <span class="glyphicon glyphicon-unchecked"></span>
               </button>
            </div>
            
            {if condition="$fsc->show_cerrar"}
            <a class="btn btn-sm btn-danger" href="{$fsc->url()}&cerrar=TRUE">
               <span class="glyphicon glyphicon-lock"></span>
               &nbsp; Cerrar caja
            </a>
            {/if}
         </div>
         <div class="col-lg-6 col-md-6 col-sm-6 text-right">
            <button class="btn btn-sm btn-primary" type="submit" onclick="this.disabled=true;this.form.submit();">
               <span class="glyphicon glyphicon-floppy-disk"></span>
               &nbsp; Guardar
            </button>
         </div>
      </div>
   </div>
   
   <div class="table-responsive">
      <table class="table table-hover">
         <thead>
            <tr>
               <th>Eliminar</th>
               <th>Caja</th>
               <th>Empleado</th>
               <th>Fecha inicial</th>
               <th class="text-right">Dinero inicial</th>
               <th>Fecha fin</th>
               <th class="text-right">Diferencia</th>
               <th class="text-right">Tickets</th>
            </tr>
         </thead>
         {loop="$fsc->resultados"}
         <tr>
            <td class="text-center">
               <input type="checkbox" name="delete[]" value="{$value->id}"/>
            </td>
            <td class="text-center">{$value->fs_id}</td>
            <td class="text-center">
               {if condition="$value->agente"}
               <a href="{$value->agente->url()}">{$value->agente->get_fullname()}</a>
               {else}
               -
               {/if}
            </td>
            <td class="text-center">{$value->fecha_inicial}</td>
            <td class="text-right">{$fsc->show_precio($value->dinero_inicial)}</td>
            <td class="text-center">{$value->show_fecha_fin()}</td>
            <td class="text-right">{$fsc->show_precio($value->diferencia())}</td>
            <td class="text-right">{$value->tickets}</td>
         </tr>
         {else}
         <tr class="bg-warning">
            <td colspan="8" class="text-center">Sin resultados.</td>
         </tr>
         {/loop}
      </table>
   </div>
   
   <ul class="pager">
      {if condition="$fsc->anterior_url()!=''"}
      <li class="previous">
         <a href="{$fsc->anterior_url()}">
            <span class="glyphicon glyphicon-chevron-left"></span>
            &nbsp; Anteriores
         </a>
      </li>
      {/if}
      
      {if condition="$fsc->siguiente_url()!=''"}
      <li class="next">
         <a href="{$fsc->siguiente_url()}">
            Siguientes &nbsp;
            <span class="glyphicon glyphicon-chevron-right"></span>
         </a>
      </li>
      {/if}
   </ul>
</form>

{include="footer"}